import React, {Component} from 'react'
import { observer} from 'mobx-react';
import { Tools, Tabs } from "weaver-mobile";
import Coms from './content/index';
import CustTabs from '../coms/Tabs';
const getLabel = Tools.getLabel;
const {SwipeActionList, BasicList, OrgTreeList, TreeList, AllResourceList, SearchList} = Coms;

@observer
export default class Content extends Component {
    render() {
        const {store} = this.props;
        const {initialPage, setActiveTab, pageType} = store;
        const tabConfig = {
            tabs: [
                {title: getLabel(24515, '最近')},
                {title: getLabel(18511, '同部门')},
                {title: getLabel(15089, '我的下属')},
                {title: getLabel(18770, '按组织结构')},
                {title: getLabel(81554, '常用组')},
                // {title: getLabel(1340, '所有人')}
            ],
            tabProps: {
                initialPage,
                onTabClick: (tab, index) => {
                    setActiveTab(index);
                },
                onChange: (tab) => {
                },
                renderTabBar: props => {
                    return (
                        <Tabs.DefaultTabBar
                            renderTab={tab =>
                            (<span className="tab-bar">{tab.title}</span>)
                            }
                            {...props}
                            activeTab={initialPage == 6 ? -1 : initialPage}
                        />
                    )
                }
            }
        }
        return (
            <div className={`tabs${(pageType === "group") ? " hide-tabs" : ""}`}>
                <CustTabs store={store} tabConfig={tabConfig}>
                    <SwipeActionList title={getLabel(24515, '最近')}/>
                    <BasicList title={getLabel(18511, '同部门')}/>
                    <BasicList title={getLabel(15089, '我的下属')}/>
                    <OrgTreeList title={getLabel(18770, '按组织结构')}/>
                    <TreeList title={getLabel(81554, '常用组')}/>
                    <AllResourceList title={getLabel(1340, '所有人')}/>
                    <SearchList />
                </CustTabs>
            </div>
        )
    }
}